import 'package:chat_app_project/models/res_entity.dart';
import 'package:chat_app_project/models/user_login_info_entity.dart';
import 'package:chat_app_project/tool/request_client.dart';

const CREATE = "/app/demand/save";
const FOLLOW = "/app/demand/list/follow";
const NEARBY = "/app/demand/list/nearby";
const RECOMMEND = "/app/demand/list/recommend";

class DemandDao {
  //{
  //   "circleId": 0,
  //   "content": "",
  //   "demandDuration": 0,
  //   "id": "",
  //   "labels": [],
  //   "lat": 0,
  //   "lng": 0,
  //   "location": "",
  //   "money": 0,
  //   "title": "",
  //   "type": ""
  // }
  static Future<ResEntity> create(Map<String, dynamic> params) async {
    var req = RequestClient();
    final response = await req.post(CREATE, data: params);
    return ResEntity.fromJson(response.data);
  }
  static Future<ResEntity> follow(Map<String, dynamic> params) async {
    var req = RequestClient();
    final response = await req.get(FOLLOW, queryParameters: params);
    return ResEntity.fromJson(response.data);
  }
  static Future<ResEntity> nearby(Map<String, dynamic> params) async {
    var req = RequestClient();
    final response = await req.get(NEARBY, queryParameters: params);
    return ResEntity.fromJson(response.data);
  }
  static Future<ResEntity> recommend(Map<String, dynamic> params) async {
    var req = RequestClient();
    final response = await req.get(RECOMMEND, queryParameters: params);
    return ResEntity.fromJson(response.data);
  }
}
